<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="t_product" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="popProcessDiagram('')" type='primary' size="mini">查看流程图</el-button>
      <el-button @click="gotoPage('/mes/produce/flow/AddRecordProcess?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 检测项目 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="项目编号" prop="">
              {{t_product.process_num}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="项目条形码" prop="">
              {{t_product.process_barcode}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="项目类别" prop="">
              {{t_product.description}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="项目名称" prop="">
              {{t_product.process_name}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="文件标准号" prop="">
              {{t_product.subject}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="文件标准名称" prop="">
              {{t_product.client_filename}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="项目描述" prop="">
              {{t_product.process_des}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="项目时长" prop="">
              {{t_product.process_duration}}
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 国家标准 </span>
      </div>
      <el-table :data="s_file">
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="gotoPage('/xcapi/ProcessFile/DownloadFile.do?&fileverid='+scope.row.version_id+''+vueparams+'')">下载</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="主题" prop="subject">
        </el-table-column>
        <el-table-column label="文件" prop="version_id">
          <template slot-scope="scope">
          </template>
        </el-table-column>
        <el-table-column label="类型" prop="client_filename">
        </el-table-column>
        <el-table-column label="尺寸" prop="size">
        </el-table-column>
        <el-table-column label="版本" prop="version">
        </el-table-column>
      </el-table>
      <el-button @click="executionProcedureSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 检测记录 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-input type="textarea" v-model="empty" ttparea=350></el-input>
          </el-col>
        </el-row>
      </div>
      <el-button @click="executionProcedureSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
    </el-form>
    <el-dialog :visible.sync="ProcessDiagramVisible" append-to-body>
      <ProcessDiagram v-if="ProcessDiagramVisible" ref="ProcessDiagram" :popparams="popparams"> </ProcessDiagram>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ProcessDiagram from "@/views/mes/produce/flow/ProcessDiagram";
  export default {
    name: 'ExecutionProcedure',
    components: {
      ProcessDiagram,
    },
    props: ['popparams'],
    data() {
      return {
        ProcessDiagramVisible: false,
        ProcessDiagramValue: null,
        ProcessDiagramDesc: null,
        vueparams: this.getVUEParams(""),
        t_product: {
          process_num: null,
          process_barcode: null,
          description: null,
          process_name: null,
          subject: null,
          client_filename: null,
          process_des: null,
          process_duration: null,
        },
        s_file: [],
        step: [],
        s_record_table: {},
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/produce/flow/ProducePlan/executionProcedure?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      executionProcedureSubmit(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/produce/flow/ProducePlan/executionProcedureSubmit?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.gotoPage("/mes/produce/flow/ProcessDiagram/processDiagram?" + this.vueparams, data);
          this.msgSuccess(data.msg);
        })
      },
      popProcessDiagram(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ProcessDiagramVisible = !this.ProcessDiagramVisible;
      },
    },
  }
</script>
